// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   ChartGraphics.java

package com.java4less.rchart.gc;


// Referenced classes of package com.java4less.rchart.gc:
//			ChartImage, ChartColor, ChartFont

public abstract class ChartGraphics
{

	public static int STROKE_NORMAL = 1;
	public static int STROKE_DOTTED = 2;
	public static int STROKE_DASHED = 3;
	protected int lineStyle;
	protected int lineWidth;
	protected ChartImage textureImage;
	public static int ROTATE_CENTER = 0;
	public static int ROTATE_LEFTTOP = 1;

	public ChartGraphics()
	{
		lineStyle = STROKE_NORMAL;
		lineWidth = 1;
		textureImage = null;
	}

	public void setColor(ChartColor chartcolor)
	{
	}

	public void setFont(ChartFont chartfont)
	{
	}

	public ChartColor getColor()
	{
		return null;
	}

	public ChartFont getFont()
	{
		return null;
	}

	public void setTexture(ChartImage image)
	{
		textureImage = image;
	}

	public void drawArc(int i, int j, int k, int l, int i1, int j1)
	{
	}

	public void drawLine(int i, int j, int k, int l)
	{
	}

	public int getFontHeight()
	{
		return getFontHeight(null);
	}

	public int getFontHeight(ChartFont font)
	{
		return 0;
	}

	public int getFontWidth(ChartFont font, String s)
	{
		return 0;
	}

	public int getFontWidth(String s)
	{
		return getFontWidth(null, s);
	}

	public boolean drawRotatedText(ChartFont descFont, ChartColor descColor, String txt, int i, int j, int k, boolean flag)
	{
		return false;
	}

	public void drawString(String s1, int i, int j)
	{
	}

	public void drawImage(ChartImage chartimage, int i, int j)
	{
	}

	public void drawImage(ChartImage chartimage, int i, int j, int k, int l, int i1, int j1, 
			int k1, int l1)
	{
	}

	public void fillPolygon(int ai[], int ai1[], int i)
	{
	}

	public void fillRect(int i, int j, int k, int l)
	{
	}

	public void fillRoundRect(int x1, int y1, int w, int h)
	{
		fillRect(x1, y1, w, h);
	}

	public void drawPolygon(int ai[], int ai1[], int i)
	{
	}

	public void drawRect(int x1, int y1, int w, int h)
	{
		drawLineWithStyle(x1, y1, x1, y1 + h);
		drawLineWithStyle(x1, y1, x1 + w, y1);
		drawLineWithStyle(x1, y1 + h, x1 + w, y1 + h);
		drawLineWithStyle(x1 + w, y1, x1 + w, y1 + h);
	}

	public void drawRoundedRect(int x1, int y1, int w, int h)
	{
		drawRect(x1, y1, w, h);
	}

	public void createFadeArea(ChartColor chartcolor, ChartColor chartcolor1, int i, int j, int k, int l, boolean flag, 
			boolean flag1)
	{
	}

	public void fillArc(int i, int j, int k, int l, int i1, int j1)
	{
	}

	public void setAlpha(float f)
	{
	}

	public void setAlphaComposite(Object obj)
	{
	}

	public Object getAlphaComposite()
	{
		return null;
	}

	public void setLineStyle(int style)
	{
		lineStyle = style;
	}

	public void setLineWidth(int w)
	{
		lineWidth = w;
	}

	public void dispose()
	{
	}

	public void paintRotatedImage(ChartImage chartimage, int i, int j, int k, int l)
	{
	}

	protected void drawSimpleLine(int x1, int y1, int x2, int y2)
	{
		int pixelsWidth = 1;
		pixelsWidth = lineWidth * 1;
		if (pixelsWidth < 1)
			pixelsWidth = 1;
		drawLine(x1, y1, x2, y2);
		if (pixelsWidth == 1)
			return;
		if (pixelsWidth > 1)
		{
			int xwidth = 0;
			int ywidth = 0;
			int h = Math.abs(y2 - y1);
			int w = Math.abs(x2 - x1);
			double hipo = Math.sqrt(h * h + w * w);
			double Cos = (double)w / hipo;
			xwidth = 1;
			ywidth = 0;
			if (Cos > Math.cos(1.0471666666666668D))
			{
				xwidth = 0;
				ywidth = 1;
			}
			if (Cos > Math.cos(0.5235833333333334D))
			{
				xwidth = 0;
				ywidth = 1;
			}
			int side = 1;
			int distanceToCenter = 0;
			for (int i = 2; i <= pixelsWidth; i++)
			{
				if (side == 1)
					distanceToCenter++;
				drawLine(x1 + side * xwidth * distanceToCenter, y1 + side * ywidth * distanceToCenter, x2 + side * xwidth * distanceToCenter, y2 + side * ywidth * distanceToCenter);
				side *= -1;
			}

		}
	}

	public void drawLineWithStyle(int x1, int y1, int x2, int y2)
	{
		if (lineStyle == STROKE_NORMAL)
		{
			drawSimpleLine(x1, y1, x2, y2);
		} else
		{
			int segment = 10;
			int segmentspace = 10;
			if (lineStyle == STROKE_DOTTED)
			{
				segment = 1;
				segmentspace = 5;
			}
			int h = Math.abs(y2 - y1);
			int w = Math.abs(x2 - x1);
			if (h == 0 && w == 0)
				return;
			double hipo = Math.sqrt(h * h + w * w);
			double Cos = (double)w / hipo;
			double Sin = (double)h / hipo;
			int Xslope = 1;
			int Yslope = 1;
			if (x2 < x1)
				Xslope = -1;
			if (y2 < y1)
				Yslope = -1;
			int subx1 = 0;
			int suby1 = 0;
			int subx2 = 0;
			int suby2 = 0;
			int subsegment = 0;
			do
			{
				suby2 = (int)(Sin * (double)(subsegment + segment)) * Yslope;
				subx2 = (int)(Cos * (double)(subsegment + segment)) * Xslope;
				suby1 = (int)(Sin * (double)subsegment) * Yslope;
				subx1 = (int)(Cos * (double)subsegment) * Xslope;
				if (w < Math.abs(subx1) || h < Math.abs(suby1))
					break;
				if (w < Math.abs(subx2))
					subx2 = w * Xslope;
				if (h < Math.abs(suby2))
					suby2 = h * Yslope;
				drawSimpleLine(x1 + subx1, y1 + suby1, x1 + subx2, y1 + suby2);
				subsegment = subsegment + segment + segmentspace;
			} while (true);
		}
	}

}
